<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserCourseColumnBuyLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_course_column_buy_logs', function (Blueprint $table) {
            $table->id();
            $table->integer('userId', false, true)->index()->comment('用户ID');
            $table->integer('dataId', false, true)->index()->comment('专栏ID');
            $table->tinyInteger('getType', false, true)->index()->comment('获得方式：1=购买，2=激活码');
            $table->timestamps();
        });

        DB::statement("ALTER TABLE user_course_column_buy_logs comment '用户购买专栏记录'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_course_column_buy_logs');
    }
}
